package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.vo.*;
import com.cskaoyan.service.StatService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zoey-zhu
 * @description: 统计报表: admin/stat
 * @Date 10:41 2021/07/09
 */
@RestController
@RequestMapping("admin/stat")
public class StatController {

    @Autowired
    StatService statService;

    /**
     * @Author: zoey-zhu
     * @description: 统计报表: 用户统计(GET)
     * @Date 10:53 2021/7/9
     * url: http://182.92.235.201:8083/admin/stat/user
     */
    @GetMapping("/user")
    @RequiresPermissions("admin:stat:user")
    public BaseRespVo statUser() {

        StatBaseVO<StatUserVO> data = statService.statUser();

        return BaseRespVo.ok(data);
    }

    /**
     * @Author: zoey-zhu
     * @description: 统计报表: 订单统计(GET)
     * @Date 10:53 2021/7/9
     * url: http://182.92.235.201:8083/admin/stat/order
     */
    @GetMapping("/order")
    @RequiresPermissions("admin:stat:order")
    public BaseRespVo statOrder() {

        StatBaseVO<StatOrderVO> data = statService.statOrder();

        return BaseRespVo.ok(data);
    }

    /**
     * @Author: zoey-zhu
     * @description: 统计报表: 商品统计(GET)
     * @Date 10:53 2021/7/9
     * url: http://182.92.235.201:8083/admin/stat/goods
     */
    @GetMapping("/goods")
    @RequiresPermissions("admin:stat:goods")
    public BaseRespVo statGoods() {

        StatBaseVO<StatGoodsVO> data = statService.statGoods();

        return BaseRespVo.ok(data);
    }
}
